﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Albara.aspx.cs" Inherits="Vista.Privat.Albaran"
    MasterPageFile="~/Gestio/GestioMasterPage.master" %>

<%@ MasterType VirtualPath="~/Gestio/GestioMasterPage.master" %>
<%@ Register Src="~/Controls/ModalPanel.ascx" TagPrefix="ctrl" TagName="Modal" %>

<asp:Content ID="bodyAlbaran" ContentPlaceHolderID="privateCPHBody" runat="server">
    <%--<asp:ScriptManager ID="smAlbaran" runat="server" />--%>
    <%--Cercar un Albaran--%>
    <asp:UpdatePanel ID="upBuscarAlbara" runat="server" Visible="true" UpdateMode="Conditional">
        <ContentTemplate>
            <div id="divAlbaran">
                <br />
                <asp:Label CssClass="classTitul" Text="Cercar Albarà" runat="server" />
                <br />
                <asp:DropDownList ID="ddlClient" runat="server" DataSourceID="odsClient" DataTextField="NomClient"
                    DataValueField="IdClient" Width="35%" />
                <asp:TextBox ID="txtDataIni" TextMode="Date" runat="server" Width="30%" />
                <asp:TextBox ID="txtDataFi" TextMode="Date" runat="server" Width="30%" />
                <br />
                <%--Carrega l'objecte Client des de negoci--%>
                <asp:ObjectDataSource ID="odsClient" runat="server" DataObjectTypeName="DeltaFlex.Negoci.Client"
                    SelectMethod="LlistarClientByIDClient" TypeName="DeltaFlex.Negoci.Client">
                    <SelectParameters>
                        <asp:QueryStringParameter Name="idClient" QueryStringField="empid" DefaultValue="0" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <br />
                <asp:Button ID="btnCercarAlbara" OnClick="btnCercarAlbara_Click" Text="Cercar" runat="server"
                    CausesValidation="false" CssClass="classBotonsDreta" Style="margin-right: 5%" />
                <br />
                <%--GridView--%>
                <asp:Label Text="Resultats de la Cerca" CssClass="classEsquerra" runat="server" Width="160px" />
                <asp:GridView ID="gvAlbarans" AutoGenerateColumns="false" runat="server" Caption="Cerca d'Albarans segons criteris"
                    EmptyDataText="No hi ha cap Albarà" Width="910px" AlternatingRowStyle-BackColor="ActiveBorder"
                    AlternatingRowStyle-BorderColor="ActiveCaption" OnRowCommand="gvAlbarans_RowCommand" >
                    <Columns>
                        <asp:TemplateField HeaderText="Opcions" ItemStyle-Width="50px">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkAlbara" runat="server" />
                                <asp:ImageButton ID="btnEditGVAlbara" runat="server" AlternateText="Obrir un albarrà per a editar-lo"
                                    ImageUrl="~/Imatges/editar_Grid.png" CommandName="Editar" CommandArgument='<%# Eval("IdAlbara") %>'
                                    CausesValidation="false" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField ControlStyle-Width="70" HeaderText="Albarà" DataField="IdAlbara" />
                        <asp:BoundField ControlStyle-Width="70" HeaderText="Ordre Treball" DataField="BindOrdreTreball" />
                        <asp:BoundField ControlStyle-Width="70" HeaderText="Client" DataField="BindClient" />
                        <asp:BoundField ControlStyle-Width="70" HeaderText="Data" DataField="BindData" />
                        <asp:BoundField ControlStyle-Width="70" HeaderText="Import Total" DataField="BindImportTotal" />
                    </Columns>
                </asp:GridView>
                <br />
                <asp:Button ID="btnCrearFactura" OnClick="btnCrearFactura_Click" Text="Crear Factura"
                    ToolTip="Crear factures" runat="server" CausesValidation="false" CssClass="classBotonsDreta"
                    Style="margin-right: 5%; margin-left:5px;" Visible="false" />
                <asp:TextBox ID="txtIVA" runat="server" CssClass="classBotonsDreta" Visible="false" style="margin-right:5px;margin-left:5px;" />
                <asp:label ID="lblIVA" runat="server" CssClass="classBotonsDreta" Visible="false" Text="IVA" style="margin-right:5px;"/>
                <asp:TextBox ID="txtDescompte" runat="server" CssClass="classBotonsDreta" Visible="false" style="margin-right:5px;margin-left:5px;" />
                <asp:label ID="lblDescompte" runat="server" CssClass="classBotonsDreta" Visible="false" Text="Descompte" style="margin-right:5px;"/>
                <asp:TextBox ID="txtVenciment" runat="server" CssClass="classBotonsDreta" Visible="false" style="margin-right:5px;margin-left:5px;" TextMode="DateTime" />
                <asp:label ID="lblVenciment" runat="server" CssClass="classBotonsDreta" Visible="false" Text="Venciment" style="margin-right:5px;"/>

                <br />
            </div>
            <%--Crida al control Modal--%>
            <ctrl:Modal ID="mpAlbara" runat="server" />
        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="btnCrearFactura" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Content>
